name: Delete old container images

on:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * *"  # every day at midnight


jobs:
  dev-clean-ghcr:
    name: Delete old unused dev container images
    runs-on: ubuntu-latest
    steps:
      - name: Delete dev branch containers older than a month
        uses: snok/container-retention-policy@v2
        with:
          image-names: qdrant
          cut-off: A month ago UTC
          account-type: org
          org-name: qdrant
          keep-at-least: 10
          filter-tags: dev-*
          token-type: github-token
          token: ${{ secrets.GITHUB_TOKEN }}
          dry-run: true
